package com.lw.question05;

import java.text.DecimalFormat;
import java.util.Scanner;

import static java.lang.Math.sqrt;

/**
 * @author LW
 * @2020/9/15 15:52
 */
public class 两坐标的距离2 {
    public static void main(String[] args) {
        System.out.println("请输入坐标：");
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        //正立方根sqrt()
        double X=sqrt((a-c)*(a-c)+(b-d)*(b-d));
//        java保留两位小数4种方法
        /**
         * DecimalFormat转换最简便
         * String.format打印最简便
         */
        //保留两位小数
        DecimalFormat df = new DecimalFormat("#.00");

        System.out.println(df.format(X));





    }
}
